#!/usr/bin/python

import sys
import pir
import os
from stat import *

print "libPirate RomSfam tester (cli)\nCopyright (c) 2007 Derrick Sobodash"

if len(sys.argv) < 2:
	print "No input file specified!"
	raise SystemExit

file = sys.argv[1]

f = open(file, "rb")
size = os.stat(file)[ST_SIZE]
data = f.read(size)
f.close()

temp = pir.RomSfam(data)

print pir.copy, "\n"

print "Game Title:    ", temp.getname()
print "Game Code:     ", temp.getcode()
print "Licensee:      ", temp.getmaker()
print "Map Mode:      ", temp.getmap()
print "CPU Speed:     ", temp.getcpu()
print "Expansion RAM: ", temp.getexram()
print "Special:       ", temp.getspecial()
print "Cart Type:     ", temp.getcart()
print "Co-processor:  ", temp.getcoproc()
print "ROM Size:      ", temp.getromsize()
print "ROM Revision:  ", temp.getrevision()
print "RAM Size:      ", temp.getramsize()
print "Cart Subnum:   ", temp.getsubnum()
print "Region:        ", temp.getregion()
print "Checksum:      ", hex(temp.getchecksum())
print "Tests:"
print "  Sufami Turbo:          ", temp.issufami()
print "  Satellaview:           ", temp.issatella()
print "  Socketed Cart:         ", temp.issocket()
print "  Revised Header:        ", temp.isrevised()
print "  Seta DSP Chip:         ", temp.issetadsp()
print "  Seta RISC Chip:        ", temp.issetarisc()
print "  OBC1 Chip:             ", temp.isobc1()
print "  Super FX Mario Chip:   ", temp.ismariofx()
print "  Super FX Chip:         ", temp.issfx()
print "  Super FX-2 Chip:       ", temp.issfx2()
print "  Super FX (21MHz) Chip: ", temp.isocsfx()
print "  SA-1 Chip:             ", temp.issa1()
print "  C4 Chip:               ", temp.isc4()
print "  SPC7110 Chip:          ", temp.isspc7110()
print "  Super Game Boy:        ", temp.issgb()
print "  RTC Chip:              ", temp.isrtc()
print "  DSP-1 Chip:            ", temp.isdsp1()
print "  DSP-1A Chip:           ", temp.isdsp1a()
print "  DSP-1B Chip:           ", temp.isdsp1b()
print "  DSP-2 Chip:            ", temp.isdsp2()
print "  DSP-3 Chip:            ", temp.isdsp3()
print "  DSP-4 Chip:            ", temp.isdsp4()


